package cn.iocoder.yudao.module.picturebook.controller.admin.oss;

import cn.iocoder.yudao.module.picturebook.service.oss.OssService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.List;

@Tag(name = "绘本系统 - 文件上传接口")
@RestController
@RequestMapping("/picturebook/oss")
public class OssController {

    @Resource
    private OssService ossService;

    /**
     * 单个文件上传接口
     */
    @Operation(summary = "上传文件")
    @PostMapping("/upload")
    public String uploadFile(@RequestParam("file") MultipartFile file) {
        return ossService.uploadFile(file);
    }

    /**
     * 多个文件上传接口
     */
    @Operation(summary = "上传多个文件")
    @PostMapping("/upload-list")
    public List<String> uploadFiles(@RequestParam("files") List<MultipartFile> files) {
        return ossService.uploadFiles(files);
    }
}    